package com.template.app.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.template.app.model.Response;

public class BaseInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response,
			Object handler,	ModelAndView mav) throws Exception
	{
		if (mav != null) {
			if (!mav.getModelMap().containsAttribute(Response.NAME)) {
				mav.getModelMap().addAttribute(new Response());
			}
		}
	}
}
